using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;using Maxleaf.EDI.Domain.K3;

namespace Maxleaf.EDI.DataAccess.K3
{
    public class t_BarcodeMap : EntityTypeConfiguration<t_Barcode>
    {
        public t_BarcodeMap()
        {
            // Primary Key
            this.HasKey(t => new { t.FTypeID, t.FItemID, t.FID });

            // Properties
            this.Property(t => t.FTypeID)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.FItemID)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.FID)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);

            this.Property(t => t.FBarCode)
                .IsRequired()
                .HasMaxLength(128);

            this.Property(t => t.FRemark)
                .HasMaxLength(100);

            // Table & Column Mappings
            this.ToTable("t_Barcode");
            this.Property(t => t.FTypeID).HasColumnName("FTypeID");
            this.Property(t => t.FItemID).HasColumnName("FItemID");
            this.Property(t => t.FID).HasColumnName("FID");
            this.Property(t => t.FBarCode).HasColumnName("FBarCode");
            this.Property(t => t.FRemark).HasColumnName("FRemark");
        }
    }
}
